<?php

class OrganizationalUnitPropertyRecipientDeterminationRule extends AbstractMemberIdRecipientDeterminationRule
{
  
  /**
   * @var OrganizationalUnit
   */
  protected $unit;
  
  /**
   * @var string
   */
  protected $property;

  /**
   * 
   * Enter description here ...
   * @param OrganizationalUnit $unit
   * @param string $property
   * @param array $options
   */
  public function __construct (OrganizationalUnit $unit, $property, array $options = array())
  {
    $this->unit = $unit;
    $this->property = $property;
    parent::__construct($options);
  }

  public function doCalculate ()
  {
    return $this->unit->getPropertyValue($this->property)
      ->getValue();
  }

}